﻿using St.MODLD;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Goods
{
    public partial class buygoods : Form
    {
        public List<GoodsInfo> jiang;
        public GoodsInfo SelectedGood { get; set; }
        public buygoods(List<GoodsInfo> list)
        {
            InitializeComponent();
            this.jiang = list;
        }

        private void buygoods_Load(object sender, EventArgs e)
        {
            buygoodsinfo.AutoGenerateColumns = false;
            buygoodsinfo.DataSource = jiang;
        }

        private void buygoodsinfo_KeyUp(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (buygoodsinfo.SelectedRows.Count == 1)
                {
                    int ind = buygoodsinfo.SelectedRows[0].Index;
                    SelectedGood = jiang[ind - 1];
                    this.Close();
                }

            }
        }
    }
}
